package sunbt.gistools.enums;

import cn.hutool.core.util.ObjUtil;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldNameConstants;

/**
 * 通用状态枚举
 *
 * @author huangsh
 * @since 2024/08/19
 */
@Getter
@FieldNameConstants
@RequiredArgsConstructor
public enum CommonStatusEnum implements BaseEnum {

    ENABLE(1, "启用"),

    DISABLE(0, "禁用");

    /**
     * 状态值
     */
    @EnumValue
    @JsonValue
    private final Integer code;

    /**
     * 状态名
     */
    private final String desc;

    public static boolean isEnable(Integer status) {
        return ObjUtil.equal(ENABLE.code, status);
    }

    public static boolean isDisable(Integer status) {
        return ObjUtil.equal(DISABLE.code, status);
    }

}
